package org.rich.charlesmurphy.core.analyze;

import org.ddevil.data.Filter;
import org.ddevil.data.set.DataSet;
import org.rich.charlesmurphy.model.Request;
import org.rich.charlesmurphy.model.RequestGroup;

/**
 * Object that will analyze a set of {@link Request} objects, and create {@link RequestGroup}s from it.
 * @author Rich
 */
public interface RequestSetAnalyzer {

	/**
	 * Analyze the given {@link Request} objects and attempt to break them out into {@link RequestGroup}s.
	 * The input set of requests should be ordered by date.  This assumption can be made my implementors.
	 * @param requests the set of requests
	 * @return the input requests broken out into groups
	 */
	DataSet<RequestGroup> analyze(DataSet<Request> requests);

	/**
	 * Add a filter that will be used to determine if a request should
	 * be included for analysis.  Ignored requests will not be included when building {@link RequestGroup}s
	 * but will be left in the input set of requests.
	 * @param filter filter to add
	 * @return this for method chaining
	 */
	RequestSetAnalyzer addFilter(Filter<Request> filter);

}
